﻿using System;

namespace TimeTable.Domain.Entity
{
    public class TimeTableUnit : IComparable<TimeTableUnit>
    {
        public int ID { get; set; }
        public string Subject { get; set; }
        public StudyUnit StudyUnit { get; set; }
        public Teacher Teacher { get; set; }
        public Room Room { get; set; }
        public TimeTable TimeTable { get; set; }
        public DateTime BeginTime { get; set; }
        public DateTime EndTime { get; set; }
        public DayOfWeek DayOfWeek { get; set; }

        public int CompareTo(TimeTableUnit other)
        {
            if (BeginTime < other.BeginTime) return -1;
            if (BeginTime > other.BeginTime) return 1;

            return 0;
        }

        public override string ToString()
        {
            return string.Format("{0} - {1} | {2}/{3} | {4} | {5}",
                BeginTime.ToString("HH:mm"),
                EndTime.ToString("HH:mm"), 
                Room.RoomNumber, 
                Room.BuildingNumber, 
                Subject,
                Teacher.LastName);
        }
    }
}
